UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'amaiRwC/ajTCO2D+m+X+IGBLVYzzNNSXtUPIU+U5Cn4='
WHERE
key_id = '95aa4d0df383c008c582e20553926cbb3dfb3c8d562936f4e6ac909aa8922ef5'
AND (
token = 'amaiRwC/ajTCO2D+m+X+IGBLVYzzNNSXtUPIU+U5Cn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)