UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AuZj5OxW7GOBE+NojFUG+0Zqa2N16469e0qd+xH7kTM='
WHERE
key_id = 'c960ae98e9c28dd8beca25a5431c3af5e1554ea49efb399c956b016ce86a96cf'
AND (
token = 'AuZj5OxW7GOBE+NojFUG+0Zqa2N16469e0qd+xH7kTM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)