UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bh6YbJ3KaB4nd8LWHF5xfKoxo+7jSkZ5uUj2/36nKfM='
WHERE
key_id = '66ec8757ac38859598dec966fe52f90f8a389d91435f0831db637da0215f7c31'
AND (
token = 'Bh6YbJ3KaB4nd8LWHF5xfKoxo+7jSkZ5uUj2/36nKfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)