UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ayPEPSsZ1k6ZiJZI/q9Ta4Hni6aQqx8DboKmpMMN+yw=' 
WHERE 
  key_id = '5209c9ec95a9f21e092a00210e9c45a4b57b7375c7be0a905640db5e113fd922' 
  AND (
    token = 'ayPEPSsZ1k6ZiJZI/q9Ta4Hni6aQqx8DboKmpMMN+yw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020