UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nc75wAR8CZWWFEvbg4eZ2ayWer2PXzvcSq5twZRHAS8=' 
WHERE 
  key_id = '873f27d308e05f868dcbb89a07ca671cea6d6b12c7a16f2e3a2653809f1125bc' 
  AND (
    token = 'nc75wAR8CZWWFEvbg4eZ2ayWer2PXzvcSq5twZRHAS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075