UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '56PGe4t5/Ih1Vyr0Uk+j34xhJtlhl2eo4kHO/Vq7Xm0=' 
WHERE 
  key_id = '69f725f0c9946a1fa33e0562c57474efa768e1ca86ed37870c23f1e1c567fc77' 
  AND (
    token = '56PGe4t5/Ih1Vyr0Uk+j34xhJtlhl2eo4kHO/Vq7Xm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045