UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yVTm6mihpR5dJjF7e+MTeiD2VVUNSbpEJtIrlU8l4+g='
WHERE
key_id = 'd1e52c3f93cd705dc365d7f112959dc37992cf726e5925cf8ff08666455d81d8'
AND (
token = 'yVTm6mihpR5dJjF7e+MTeiD2VVUNSbpEJtIrlU8l4+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)