UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cudM9FrMYqbxm3eqhSmlhwnjtsoIRQ+WSoEaAIQnbbI=' 
WHERE 
  key_id = '715f9e93553a1a632001914f6c2edc2c1f64eb71c4e22da17bca7a0c87ddbadb' 
  AND (
    token = 'cudM9FrMYqbxm3eqhSmlhwnjtsoIRQ+WSoEaAIQnbbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043