UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qJJr6lw0SGw1vbyiAccupZ6woyIjuEF6kX7xL9WOujQ=' 
WHERE 
  key_id = '7ecace445dc6b318a9fbde2d483c911641299add9b045760db3fc54acec44c2d' 
  AND (
    token = 'qJJr6lw0SGw1vbyiAccupZ6woyIjuEF6kX7xL9WOujQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051