UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'soOgpz8bEdXenaPkuJgYvsnrbP9/jQ/FRvTj/SPYXU0=' 
WHERE 
  key_id = '029f662a97fc390a23bc413439abf23aa33fed7c7310d165481fa3a1ba0479ea' 
  AND (
    token = 'soOgpz8bEdXenaPkuJgYvsnrbP9/jQ/FRvTj/SPYXU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047