UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRd44R1jUMZChyx0GP/B0k6rcEpipFZxyaMjZU3dIG4='
WHERE
key_id = 'b62c5a8bdeb77744ea993dfcba7e8c203f0b451f5fbd6aeb9bcba66c552fe893'
AND (
token = 'aRd44R1jUMZChyx0GP/B0k6rcEpipFZxyaMjZU3dIG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)