UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zA0XXcNmWmjUearLvaY0u/ZwGveEobAWO4Lj8TOCmjg='
WHERE
key_id = 'c4da654935b5542a8d9d32362f6f2d2b65fde72c0878c41368d3271b758d6a8d'
AND (
token = 'zA0XXcNmWmjUearLvaY0u/ZwGveEobAWO4Lj8TOCmjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)