UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bLAsLjasNySNfF7wVadkcoAzxu3UQq5+SjxMvPKxmAM='
WHERE
key_id = 'ff599d3af28c9ad65029f02c750845d07a6127e21dfc822975a0f2b7713609f3'
AND (
token = 'bLAsLjasNySNfF7wVadkcoAzxu3UQq5+SjxMvPKxmAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)