UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8j/maRiZ46sPdFZpWKIuOjp1l5wloMbjozh2GvBdI8='
WHERE
key_id = 'ac60acf881302a6861683a95c194d8de99e1f64733353caf9b60a41b32404493'
AND (
token = 'S8j/maRiZ46sPdFZpWKIuOjp1l5wloMbjozh2GvBdI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)