UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7jq+A9bXoPzGgVOCfcUhQtudZo9GDavkC86oC7m2BY=' 
WHERE 
  key_id = 'f7c41f4bba6bf51f88b7451530f608da449cf1f20d25b0c4a7050a4dff77ffbb' 
  AND (
    token = 'l7jq+A9bXoPzGgVOCfcUhQtudZo9GDavkC86oC7m2BY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030