UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmGsIJC0VOcfA8DgVMxOYJXwmwdgofoFAy5cHLPejiI='
WHERE
key_id = '4c7ef5f42dd73cf12a2c8f5e014c2a269f901cae240277a594f22138386e9e96'
AND (
token = 'gmGsIJC0VOcfA8DgVMxOYJXwmwdgofoFAy5cHLPejiI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)