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