UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eNx2D7VdyH25jfFbfV5YQD1rGd7iy8Y9cKLZISkcI7M=' 
WHERE 
  key_id = '8cee80897d29142530e42671205fcda12613c351dfe0cade99f90cfb81a85658' 
  AND (
    token = 'eNx2D7VdyH25jfFbfV5YQD1rGd7iy8Y9cKLZISkcI7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028