UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thVCT2eu4/oIHUrCOjhqHNjLDqmEkiF+vRKaZCh4JvE='
WHERE
key_id = 'c50742a17c19c72be0066777fa0e3833aadbd911db16338d5d4ece1236096b98'
AND (
token = 'thVCT2eu4/oIHUrCOjhqHNjLDqmEkiF+vRKaZCh4JvE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)