UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J3gIzCxJKbYcO43DywWzkaNReu4nOicmzFkZc3JrVfc=' 
WHERE 
  key_id = '1323dce7f37d62cdad0012e23cbeee5ff440cae20127a4076fd2dad38eeb39f0' 
  AND (
    token = 'J3gIzCxJKbYcO43DywWzkaNReu4nOicmzFkZc3JrVfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029