UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AFIfpjPd3VkPprd4AnbBQSW1wCL/Nq2iILG7ni7WHN8='
WHERE
key_id = '834785162fbfc1b93165af09de140975061069c26ac8a7f4a24db2277356c76c'
AND (
token = 'AFIfpjPd3VkPprd4AnbBQSW1wCL/Nq2iILG7ni7WHN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)