UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JKLeWPebYTbZBImesEiI/10dQ5ba89K484CrFzj2Vmk=' 
WHERE 
  key_id = 'dfde2aa2dca04bb604ec2ea128e06e677742bb1f39fb5279066f3e3051018a85' 
  AND (
    token = 'JKLeWPebYTbZBImesEiI/10dQ5ba89K484CrFzj2Vmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082