UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CtpKrLs2YQk4F+xTpglbhEwcRsVLVNXF2komcqRBEIc='
WHERE
key_id = '6685408678bcb0d4d2be297680ffd95e809b9fce9edc4fadb0233489548a0522'
AND (
token = 'CtpKrLs2YQk4F+xTpglbhEwcRsVLVNXF2komcqRBEIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)