UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g39tl1ITZ3feGe+tsoKLohuZ6YCDuecLCPZnvjsbhLA=' 
WHERE 
  key_id = '25b6c82fa4986d9324cd7dfd005dad73937be600a80237ffaaaf68db86c21a1d' 
  AND (
    token = 'g39tl1ITZ3feGe+tsoKLohuZ6YCDuecLCPZnvjsbhLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069