UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDJZGYZxTeIj9dd4gHaBc27e9cUS+ndKYEti/GdFdMI=' 
WHERE 
  key_id = '572654d1c2e2cf83dc4faad737792085f192e486f1d911835930b39a4a453d4c' 
  AND (
    token = 'KDJZGYZxTeIj9dd4gHaBc27e9cUS+ndKYEti/GdFdMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042