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