UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BuPOC3t+8RjHAD6S4bSlJdyrvZpJY61M+UrmyZeAy50=' 
WHERE 
  key_id = '7f4c438148cb113f5220f8cef26e7c3c9f6a3e1d54ba82e41a35ea6e53feeac7' 
  AND (
    token = 'BuPOC3t+8RjHAD6S4bSlJdyrvZpJY61M+UrmyZeAy50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044