UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dri+4etT5aC9JT9JSFyo8DGmGVABJOTfwoVqw9H8evg=' 
WHERE 
  key_id = '36f723cadb5f4f1097344ece0991ee6243c2c75b9669a74792a7b3649f77fdb6' 
  AND (
    token = 'dri+4etT5aC9JT9JSFyo8DGmGVABJOTfwoVqw9H8evg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034