UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cu2jJfY09+hxy0mWFzQOxwnNPjK2YNYPudPMudgEQjQ=' 
WHERE 
  key_id = 'aa11fe58d110866367064d2ea7dcd163111681c5bf9fe4416d9714d6b6f11666' 
  AND (
    token = 'Cu2jJfY09+hxy0mWFzQOxwnNPjK2YNYPudPMudgEQjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032