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