UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UPL4keNHp1zUxIeR3VQr6RmkY50vLCLEp1LG3rNqwuw='
WHERE
key_id = 'c2473f9df9a7523f97ac488273b8c96643728b38f39d3251000fe985fb77a695'
AND (
token = 'UPL4keNHp1zUxIeR3VQr6RmkY50vLCLEp1LG3rNqwuw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)