UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cKHyTMT1o27xCbQHVPeFpS0UsjwMDFNWIBH/w2Y0umo='
WHERE
key_id = '8ecc4b73acb651ccd85478cf0e0bc82d970f3161e6766520ab7171134d71135c'
AND (
token = 'cKHyTMT1o27xCbQHVPeFpS0UsjwMDFNWIBH/w2Y0umo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)