UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OQDJi2xEU/ZwHptovLOxuqicfO4AM1bW49vBXDq52rs=' 
WHERE 
  key_id = '172778357f832f02900062d031f646a6398648ee76566114ae7946a470ce75e4' 
  AND (
    token = 'OQDJi2xEU/ZwHptovLOxuqicfO4AM1bW49vBXDq52rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031